<html>
<head>
<title>Credit Card Offers for Publisher {{ publisher }}</title>
<style>
  h2 {
    margin: 3ex 0 1ex;
  }
  td.cardName {
    padding-bottom: 2ex;
  }
  td {
    vertical-align: top;
    overflow: auto;
  }
  tr.details td {
    padding: 0 3ex;
    min-width: 15%;
    max-width: 33%;
  }
  tr.details td img {
    max-width: 200px;
  }
  td pre {
    margin: 3ex 3em;
    width: 500px;
  }
</style>
<script>
  function toggleDisplay(id) {
    el = document.getElementById(id);
    if (el.style.display == "none") {
      el.style.display = "block"
    } else {
      el.style.display = "none"
    }
  }
</script>
</head>
<body>
<h1>Credit Card Offers for Publisher {{ publisher }}</h1>
{% if items %}
<table cellspacing=5>
{% for item in items %}
<tr>
<td colspan=3 class="cardName">
  <h2>{{ item.cardName }}</h2>
  {{ item.network }} from {{ item.issuer }} - <a href="{{ item.trackingUrl }}">Click to apply</a>
  - <a href="javascript:toggleDisplay('pre{{forloop.counter}}');">debug</a>
<tr class="details">
<td>
  {% if item.imageUrl %}
  <img src="{{ item.imageUrl }}" title="Image from GAN" />
  {% endif %}
<td>
  {% if item.aprDisplay %}
  <div>APR: {{ item.aprDisplay }}</div>
  {% endif %}
  {% if item.annualFeeDisplay %}
  <div>Annual Fee: {{ item.annualFeeDisplay }}</div>
  {% endif %}
  {% if item.gracePeriodDisplay %}
  <div>Grace Period: {{ item.gracePeriodDisplay }}</div>
  {% endif %}
  {% if item.latePaymentFee %}
  <div>Late Payment Fee: {{ item.latePaymentFee }}</div>
  {% endif %}
  {% if item.creditRatingDisplay %}
  <div>Credit Rating: {{ item.creditRatingDisplay }}</div>
  {% endif %}
<td>
  {% if item.introAprDisplay %}
  <div>Intro APR: {{ item.introAprDisplay }}</div>
  {% endif %}
  {% if item.balanceTransferAprDisplay %}
  <div>Balance Transfer APR: {{ item.balanceTransferAprDisplay }}</div>
  {% endif %}
  {% if item.balanceTransferFeeDisplay %}
  <div>Balance Transfer Fee: {{ item.balanceTransferFeeDisplay }}</div>
  {% endif %}
  {% if item.cashAdvanceAprDisplay %}
  <div>Cash Advance APR: {{ item.cashAdvanceAprDisplay }}</div>
  {% endif %}
  {% if item.cashAdvanceFeeDisplay %}
  <div>Cash Advance Fee: {{ item.cashAdvanceFeeDisplay }}</div>
  {% endif %}
<!--
<td>
  Card benefits: <ul>
    {% for benefit in item.cardBenefits %}
    <li> {{ benefit }} </li>
    {% endfor %}
  </ul>
<td>
  Additional benefits: <ul>
    {% for benefit in item.additionalCardBenefits %}
    <li> {{ benefit }} </li>
    {% endfor %}
  </ul>
-->
</tr>
<tr>
  <td colspan=3>
  {% if item.disclaimer %}
  <div style="font-size:x-small">{{ item.disclaimer }}</div>
  {% endif %}
</tr>
<tr><td colspan=3><pre id="pre{{forloop.counter}}" style="display:none">
{{ item|pprint|linebreaks }}</pre>
<tr><td>
{% endfor %}
</table>
{% else %}
<h2>Whoops, {{ publisher }} has no associated credit card offers.</h2>
{% endif %}

</body>
</html>
